{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "不要做A语言代码修改为B语言代码的无用功。\n",
    "也不要做用A语言代码直接调用B语言代码库这样复杂、这样容易出错的傻事。\n",
    "只需让A、B语言代码的输入输出重定向到文本文件，或修改A、B语言代码让其通过文本文件输入输出。\n",
    "即可很方便地让A、B两种语言之间协调工作。\n",
    "比如：\n",
    "A将请求数据写到文件a.txt，写完后改名为aa.txt\n",
    "B发现aa.txt存在时，读取其内容，调用相应功能，将结果写到文件b.txt，写完后删除aa.txt，改名为bb.txt\n",
    "A发现bb.txt存在时，读取其内容，读完后删除bb.txt\n",
    "以上A可以替换为任何一种开发语言或开发环境，B可以替换为任何一种与A不同的开发语言或开发环境。\n",
    "除非A或B不支持判断文件是否存在、文件读写和文件更名。\n",
    "但是谁又能举出不支持判断文件是否存在、文件读写和文件更名的开发语言或开发环境呢？\n",
    "可以将临时文件放在RamDisk上提高效率减少磨损磁盘。\n",
    "数据的结构很复杂的话，文本文件的格式问题可参考json或xml\n",
    "\n",
    "共享临时文本文件这种进程之间的通讯方法相比其它方法的优点有很多，下面仅列出我现在能想到的：\n",
    "·进程之间松耦合\n",
    "·进程可在同一台机器上，也可跨机，跨操作系统，跨硬件平台，甚至跨国。\n",
    "·方便调试和监视，只需让第三方或人工查看该临时文本文件即可。\n",
    "·方便在线开关服务，只需删除或创建该临时文本文件即可。\n",
    "·方便实现分布式和负载均衡。\n",
    "·方便队列化提供服务，而且几乎不可能发生队列满的情况（除非硬盘空间满）\n",
    "·……\n",
    "\n",
    "“跨语言、跨机，跨操作系统，跨硬件平台，跨国，跨*.*的”苦海无边，\n",
    "回头是“使用共享纯文本文件进行信息交流”的岸！"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
